# Table 5

rm(list=ls(all=TRUE))

require(MASS)
require(stargazer)

#### Datasets ####
setwd("/Users/sebastian/Dropbox/The politics of interruptions - JOP RR/Replication Files/Data Rep")
load("data_empirics_rep.Rdata") 

#### MODEL 5.1 - MODEL 5.3: Strategic behavior ####
# After being interrupted, do women speak less?

# Length after aggressive interruptions
data_empirics_aggressive <- data_empirics[data_empirics$aggressive_interruption_dummy==1,]  

model_after_agg_1 <- glm.nb(length_after_aggressive ~ female_dum + ideology_ext + 
                              committee_chair + seniority + type_member +
                              party_match_pres + 
                              election_year + length_speech_nocont_100 +
                              tot_num_speeches_session_10 + mean_length_leg +
                              negative_lang_w + mujeres_dummy +
                              factor(cohort), 
                            data = data_empirics_aggressive)

# After one minute interruptions?
data_one <- data_empirics[data_empirics$one_minute_dummy==1,]

model_after_one_1 <- glm.nb(length_after_one ~ female_dum + ideology_ext + 
                              committee_chair + seniority + type_member +
                              party_match_pres + 
                              election_year + length_speech_nocont_100 +
                              tot_num_speeches_session_10 + mean_length_leg +
                              negative_lang_w + mujeres_dummy +
                              factor(cohort), 
                            data = data_one)

# After an interruptions?
data_interruption <- data_empirics[data_empirics$interruption_final_dummy==1,]

model_after_1 <- glm.nb(length_after_interruption ~ female_dum + ideology_ext + 
                          committee_chair + seniority + type_member +
                          party_match_pres + 
                          election_year  + length_speech_nocont_100 +
                          tot_num_speeches_session_10 + mean_length_leg +
                          negative_lang_w + mujeres_dummy +
                          factor(cohort), 
                        data = data_interruption)

#### TABLE 5: Length after interruption ####
setwd("/Users/sebastian/Dropbox/The politics of interruptions - JOP RR/Replication Files/Table")

stargazer(model_after_one_1, model_after_agg_1,model_after_1,
          type = "html", style = "ajps", out = "table5.html",
          covariate.labels = c("Woman","Ideological Extremism","Committee Chair",
                               "Seniority", "National MC","Same Party as Leg. Pres.",
                               "Election Year", "Length of Speech","Speeches during Debate",
                               "Mean Length of MC Speech",
                               "Negative Language (Speech)", "Topic: Women"),
          omit = "factor",
          # se = list(robust_seDEM2,robust_seAUT2,robust_seDEM_PROBIT,robust_seAUT_PROBIT,
          #           robust_seDEM_LOGIT,robust_seAUT_LOGIT),
          no.space=TRUE,
          dep.var.labels=c("Length After One-Minute Warning", "Length After Aggressive Inter.", "Length After Interruption (All)"),
          digits=3,
          df = FALSE,
          keep.stat = c("theta", "n"))
